
#pragma once

#include <WinDef.h>

// Direct Input version.
#define DIRECTINPUT_VERSION 0x0800

#include <dinput.h>

#define KEYBOARD_SIZE 256

class Input
{
public:
	Input();
	~Input();

	// Initialization & Termination.
	//-----------------------------------------------
	BOOL IsValid() CONST;

	BOOL Initialize(HINSTANCE hinstance, HWND hwnd);
	VOID Terminate();
	
	// Commands getters.
	//-----------------------------------------------
	// Mouvement commands.
	BOOL ExitPressed() CONST;
	BOOL ForwardPressed() CONST;
	BOOL BackwardPressed() CONST;
	BOOL StrafeLeftPressed() CONST;
	BOOL StrafeRightPressed() CONST;

	// Camera commands.
	BOOL CameraControlPressed() CONST;

	FLOAT MouseX() CONST;
	FLOAT MouseY() CONST;

	// Triggers.
	BOOL HDRPressed() CONST;
	BOOL RenderTypePressed() CONST;
	BOOL NextRTPressed() CONST;
	BOOL DisplayFPS() CONST;

	// Light management.
	BOOL NewLight() CONST;
	BOOL DeleteLight() CONST;



	// Updating.
	//-----------------------------------------------
	BOOL Update();

protected:
	Input(CONST Input&);
	Input& operator = (CONST Input&);

private:
	BOOL ReadMouse();
	BOOL ReadKeyboard();

	// Attributes.
	//-----------------------------------------------
	// Direct Input
	LPDIRECTINPUT8 	     m_direct_input;

	// Devices
	LPDIRECTINPUTDEVICE8 m_mouse;
	LPDIRECTINPUTDEVICE8 m_keyboard;

	// State
	LPDIMOUSESTATE	     m_mouse_state;
	LPBYTE		         m_keys;

	// Flags
	BOOL                 m_initialized;
};

